package cn.itsource.ymcc.web.controller;

import cn.itsource.ymcc.common.result.JsonResult;
import cn.itsource.ymcc.dto.UserRegistDto;
import cn.itsource.ymcc.service.IVerifycodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {

    @Autowired
    private IVerifycodeService verifycodeService;
    @GetMapping("/imageCode/{key}")
    public JsonResult imageCode(@PathVariable("key")String key){
        return verifycodeService.imageCode(key);
    }

    @PostMapping("/sendSmsCode")
    public JsonResult sendSmsCode(@Valid @RequestBody UserRegistDto userRegistDto){
        return verifycodeService.sendSmsCode(userRegistDto);
    }

}
